package com.briup.recognition.web.controller;

import com.briup.recognition.bean.RolePrivilege;
import com.briup.recognition.service.IRolePrivilegeService;
import com.briup.recognition.utils.Message;
import com.briup.recognition.utils.MessageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/rolePrivilege")
public class RolePrivilegeController {
    @Autowired
    private IRolePrivilegeService rolePrivilegeService;

    @GetMapping("query")
    public Message query(){
        List<RolePrivilege> list = rolePrivilegeService.query();
        return MessageUtil.success(list);
    }

    @PostMapping("saveOrUpdate")
    public Message saveOrUpdate(RolePrivilege rolePrivilege){
        rolePrivilegeService.saveOrUpdate(rolePrivilege);
        return MessageUtil.success("操作成功");
    }

    @DeleteMapping("deleteById")
    public Message deleById(long id){
        return MessageUtil.success("删除成功");
    }
}
